/**
 * ItemContainer
 * @version 2010.12.03
 */

class ItemContainer extends Actor 
	placeable;

var()   Class<GamePawn>  ContainedItem;
var     bool        bIsInert;

/**
 * Bump
 * @version 2010.12.03
 */
event Bump(Actor Other, PrimitiveComponent OtherComp, vector HitNormal) 
{
	local Vector vect;
	if(bIsInert)
		return;

	//Being bumped from the bottom will generate a hitnormal with a -1 z component
	if (round(HitNormal.Z) == -1) 
	{
		if (MarioPawn(Other) != None) 
		{
			vect.X = Location.X;
			vect.Y = Location.Y;
			vect.Z = Location.Z + 80;
			
			if(ContainedItem == Class'MarioItem_Mushroom' ){
				`log("Type Mushroom");
				if(MarioPawn(Other).bIsBig){	
					//SetDrawScale(2.0);
					Spawn(class'MarioItem_Flower',,, vect,);
					
				}
				else
					Spawn(ContainedItem,,, vect, Other.Rotation);
			}
			else{
				Spawn(ContainedItem,,, vect, Other.Rotation);	
			}
			
			
			bIsInert = TRUE;
		}
	}
}

defaultproperties
{
	bBlockActors    = TRUE;
	bCollideActors  = TRUE;
	bStatic         = FALSE;
	bMovable        = FALSE;
	bIsInert        = FALSE;

	bEdShouldSnap   = TRUE;

	ContainedItem   = Class'MarioItem_Mushroom';

	Begin Object Class=DynamicLightEnvironmentComponent Name=MyLightEnvironment
		ModShadowFadeoutTime        = 0.25
		MinTimeBetweenFullUpdates   = 0.20
		AmbientGlow                 = (R = .04, G = .04, B = .04, A = 1.0)
		AmbientShadowColor          = (R = .15, G = .15, B = .15)
		LightShadowMode             = LightShadow_ModulateBetter
		ShadowFilterQuality         = SFQ_High
		bSynthesizeSHLight          = TRUE
    End Object
	Components.Add(MyLightEnvironment)

	Begin Object Class=StaticMeshComponent Name=StaticMeshComponent0
		StaticMesh = StaticMesh'EngineMeshes.Cube'
		LightEnvironment = MyLightEnvironment;
		//PhysMaterialOverride = PhysicalMaterial'MarioMeshes.questionmat'
		Scale   = 0.25
	End Object
	Components.Add(StaticMeshComponent0);
}